//
//  BaseCollectionCell.swift
//  DouYu
//
//  Created by 王鹏宇 on 2018/4/16.
//  Copyright © 2018年 王鹏宇. All rights reserved.
//

import UIKit

class BaseCollectionCell: UICollectionViewCell {
    
    @IBOutlet weak var iconImageView: UIImageView!
    
    @IBOutlet weak var onlineBtn: UIButton!
    
    @IBOutlet weak var nickeNameLabel: UILabel!
    
    var anchor : AnchorModel? {
        
        didSet {
            guard let anchor = anchor else { return }
            var onlineStr : String = "100"
//            if anchor.online! >= 10000 {
//                onlineStr = String(format: "%.1f万",Float(anchor.online!) / 10000)
//            }else{
//                onlineStr = "\(anchor.online ?? 100)"
//            }
            
            onlineBtn.setTitle(onlineStr, for: UIControlState())
            nickeNameLabel.text = anchor.nickname
            
            guard let iconURL = URL(string: anchor.vertical_src!) else{ return }
            iconImageView.kf.setImage(with: iconURL)
        }
    }
    
    
}
